//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Workflow.ComponentModel;
using System.Collections;
using System.Collections.Specialized;
using System.Workflow.ComponentModel.Design;
using System.ComponentModel.Design;
using Microsoft.Research.ScientificWorkflow.NetCDF.CSharpAPI;
using System.Workflow.ComponentModel.Compiler;

using Microsoft.Research.ScientificWorkflow;
using Microsoft.Research.ScientificWorkflow.Helpers;
using System.IO;
using WorkflowData;

namespace Microsoft.Research.ScientificWorkflow.Activities
{
    [Name("NetCDF to Memory")]
    [Description("Reads a netCDF file from a location and writes the contents to a memory stream.")]
    [WorkflowCategory("NetCdf")]
    public class NetCDFToMem: Activity
    {
        #region Dependency Properties

        public static DependencyProperty InputCubeProperty =
            DependencyProperty.Register("InputCube", typeof(HyperCube), typeof(NetCDFToMem));

        [RequiredInputParam]
        [Name("Input HyperCube")]
        [Description("Hyper Cube to be converted to byte array.")]
        public HyperCube InputCube
        {
            get
            {
                return ((HyperCube)(base.GetValue(NetCDFToMem.InputCubeProperty)));
            }
            set
            {
                base.SetValue(NetCDFToMem.InputCubeProperty, value);
            }
        }

        public static DependencyProperty NcFileContentsProperty = DependencyProperty.Register("NcFileContents",
            typeof(byte[]), typeof(NetCDFToMem));

        [OutputParam]
        [Name("File Contents")]
        [Description("Contents of the nc file as byte array.")]
        public byte[] NcFileContents
        {
            get
            {
                return ((byte[])(base.GetValue(NetCDFToMem.NcFileContentsProperty)));
            }
            set
            {
                base.SetValue(NetCDFToMem.NcFileContentsProperty, value);
            }
        }

        #endregion

        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            return ActivityExecutionStatus.Closed;
        }
    }
}
